﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using App.Core.Extensions;
using App.Data;

public partial class UserControls_QuickSearch : BaseUserControl
{    
    public bool ShowAdvancedSearchLink { get; set; }
    public bool ShowGroupBorder { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        BindDropdownLists();
    }
    protected void BindDropdownLists()
    {
        BindDropdownList.PropertyTypes(ddlType, false);
        ddlType.Items.Add(new ListItem("On-going Flat", String.Format("{0}-1", ConfigReader.ApartmentPropertyTypeID, "1")));
        ddlType.Items.Add(new ListItem("Up-coming Flat", String.Format("{0}-4", ConfigReader.ApartmentPropertyTypeID, "1")));
        ddlType.SetSelectedItem(ConfigReader.ApartmentPropertyTypeID.ToString());
        ApartmentSizes();
        LandSizes();
        //BindDropdownList.Cities(ddlLocation, ConfigReader.SiteBusinessCountryID);
        BindDropdownList.Cities(ddlLocation, ConfigReader.SiteBusinessCountryID);
        ddlLocation.SetSelectedItem(ConfigReader.SiteBusinessCityID.ToString());
        //BindDropdownList.RentTypes(ddlRentType);
        BindDropdownList.Cities(ddlRentCountry, ConfigReader.SiteBusinessCountryID);
        ddlRentCountry.SetSelectedItem(ConfigReader.SiteBusinessCityID.ToString());
        BindDropdownList.Zones(ddlRentZone, ConfigReader.SiteBusinessCityID);
        BindDropdownList.SubscriptionTypes(ddlSubscriptionTypes);
    }
    public void ApartmentSizes()
    {
        BtcHousingEntities context = new BtcHousingEntities();
        var unit = context.Units.FirstOrDefault(P => P.ID != ConfigReader.LandUnitID);
        ddlSize.Items.Add(new ListItem(unit == null ? String.Empty : unit.Name, String.Empty));
        ddlSize.Items.Add(new ListItem("300", "300"));
        ddlSize.Items.Add(new ListItem("600", "600"));
        ddlSize.Items.Add(new ListItem("800", "800"));
        ddlSize.Items.Add(new ListItem("900", "900"));
        ddlSize.Items.Add(new ListItem("1000", "1000"));
        ddlSize.Items.Add(new ListItem("1200", "1200"));
        ddlSize.Items.Add(new ListItem("1500", "1500"));
        ddlSize.Items.Add(new ListItem("1800", "1800"));
        ddlSize.Items.Add(new ListItem("2200", "2200"));
        ddlSize.Items.Add(new ListItem("2700", "2700"));
        ddlSize.Items.Add(new ListItem("4500", "4500"));

        ddlSizeTo.Items.Add(new ListItem(unit == null ? String.Empty : unit.Name, String.Empty));
        ddlSizeTo.Items.Add(new ListItem("600", "600"));
        ddlSizeTo.Items.Add(new ListItem("800", "800"));
        ddlSizeTo.Items.Add(new ListItem("900", "900"));
        ddlSizeTo.Items.Add(new ListItem("1000", "1000"));
        ddlSizeTo.Items.Add(new ListItem("1200", "1200"));
        ddlSizeTo.Items.Add(new ListItem("1500", "1500"));
        ddlSizeTo.Items.Add(new ListItem("1800", "1800"));
        ddlSizeTo.Items.Add(new ListItem("2200", "2200"));
        ddlSizeTo.Items.Add(new ListItem("2700", "2700"));
        ddlSizeTo.Items.Add(new ListItem("4500", "4500"));
        ddlSizeTo.Items.Add(new ListItem("7000", "7000"));
        //throw new NotImplementedException();
    }
    public void LandSizes()
    {
        BtcHousingEntities context = new BtcHousingEntities();
        var unit = context.Units.FirstOrDefault(P => P.ID == ConfigReader.LandUnitID);
        ddlLandSizeFrom.Items.Add(new ListItem(unit == null ? String.Empty : unit.Name, String.Empty));
        ddlLandSizeFrom.Items.Add(new ListItem("1", "1"));
        ddlLandSizeFrom.Items.Add(new ListItem("2", "2"));
        ddlLandSizeFrom.Items.Add(new ListItem("3", "3"));
        ddlLandSizeFrom.Items.Add(new ListItem("5", "5"));
        ddlLandSizeFrom.Items.Add(new ListItem("10", "10"));
        ddlLandSizeFrom.Items.Add(new ListItem("20", "20"));
        ddlLandSizeFrom.Items.Add(new ListItem("30", "30"));
        ddlLandSizeFrom.Items.Add(new ListItem("40", "40"));
        //ddlLandSizeFrom.Items.Add(new ListItem("70", "70"));
        //ddlLandSizeFrom.Items.Add(new ListItem("100", "100"));


        ddlLandSizeTo.Items.Add(new ListItem(unit == null ? String.Empty : unit.Name, String.Empty));
        ddlLandSizeTo.Items.Add(new ListItem("1", "1"));
        ddlLandSizeTo.Items.Add(new ListItem("2", "2"));
        ddlLandSizeTo.Items.Add(new ListItem("3", "3"));
        ddlLandSizeTo.Items.Add(new ListItem("5", "5"));
        ddlLandSizeTo.Items.Add(new ListItem("10", "10"));
        ddlLandSizeTo.Items.Add(new ListItem("20", "20"));
        ddlLandSizeTo.Items.Add(new ListItem("30", "30"));
        ddlLandSizeTo.Items.Add(new ListItem("40", "40"));
        ddlLandSizeTo.Items.Add(new ListItem("70", "70"));
        ddlLandSizeTo.Items.Add(new ListItem("100", "100"));
        //throw new NotImplementedException();
    } 
}